<?php

namespace Gairal\CoreBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class InterestType extends AbstractType {

    public function buildForm(FormBuilderInterface $builder, array $options) {
        $builder
                ->add('name', 'text')
                ->add('description', 'text', array('required' => false))
                ->add('category', 'entity', array(
                    'class' => 'GairalCoreBundle:Category',
                    'property' => 'name',
                    'multiple' => false,
                    'expanded' => true))
        ;
    }

    public function setDefaultOptions(OptionsResolverInterface $resolver) {
        $resolver->setDefaults(array(
            'data_class' => 'Gairal\CoreBundle\Entity\Interest'
        ));
    }

    public function getName() {
        return 'unkrich_corebundle_interesttype';
    }

}
